/**
 * 分类-画家分类 后端接口
 */

const router = require('express').Router()
const { json } = require('body-parser')
const db = require('../../../dbconfig')

router.post('/classpainter',(req,res) => {
    let sql = "" // sql语句
    if(req.query.value == 1){
        sql = "select id,name,englishname,img,Painter from artisticworks where Painter='莫奈'"
    }if(req.query.value == 2){
        sql = "select id,name,englishname,img,Painter from artisticworks where Painter='梵高'"
    }if(req.query.value == 3){
        sql = "select id,name,englishname,img,Painter from artisticworks where Painter='达芬奇'"
    }if(req.query.value == 4){
        sql = "select id,name,englishname,img,Painter from artisticworks where Painter='毕加索'"
    }if(req.query.value == 5){
        sql = "select id,name,englishname,img,Painter from artisticworks where Painter='高更'"
    }
    db.query(sql, (err, data) => {
        // console.log(data)
        res.send(JSON.stringify(data))
    })
})

module.exports = router